#include <iostream>
#include <vector>
#include <cstring>
#include <cstdlib>
#include <unordered_map>

using namespace std;

unordered_map<int,int> m;

vector<int> twoSum(vector<int>& nums, int target) {
    vector<int> res;
    for(int i=0;i<nums.size();i++)
    {
        m[nums[i]]=i;
    }
    for(int i=0;i<nums.size();i++)
    {
        int temp=target-nums[i];
        if(m.find(temp)!=m.end()&&m[temp]!=i)
        {
            res.push_back(i);
            res.push_back(m[temp]);
            break;
        }
    }
    return res;
}

int main()
{
    int n,target;
    vector<int> nums;
    vector<int> res;
    cin>>n;
    for (int i=0;i<n;i++)
    {
        int num;
        cin>>num;
        nums.push_back(num);
    }
    res=twoSum(nums,target);
    for (int i=0;i<res.size();i++)
    {
        cout<<res[i]<<" ";
    }
}